package com.bxs.message;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Component;

@Component
public class MessageUtils {
    @Autowired
    JavaMailSenderImpl mailSender;

    public void sendSimpleEmail(String subject, String content, String from, String to){
        SimpleMailMessage mailMessage = new SimpleMailMessage();

        mailMessage.setSubject(subject);
        mailMessage.setText(content);

        mailMessage.setTo(from);
        mailMessage.setFrom(to);

        mailSender.send(mailMessage);
    }
}
